package config

import (
	"fmt"
	"github.com/spf13/viper"
)

type Mysql struct {
	Host     string
	Port     string
	User     string
	Password string
	Database string
}
type Redis struct {
	Host     string
	Port     string
	Password string
	Database int
}

type Jwt struct {
	APP_KEY string
}

type QiNiu struct {
	AccessKey string
	SecretKey string
	Bucket    string
	Url       string
}
type AppConfig struct {
	Mysql
	Redis
	Jwt
	QiNiu
}

var Config AppConfig

func InitConfig() {
	viper.SetConfigFile("../config/config.yaml")
	viper.ReadInConfig()
	viper.Unmarshal(&Config)
	fmt.Println("配置文件读取成功")
}
